﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
        $hknk=$_REQUEST["ma"];
		$cnk=$_SESSION['cnk']; 
        $sql=mysql_query("select * from khoa where username='$cnk'");
		$r=mysql_fetch_row($sql);
		$tenkhoa=$r[1];
		$makhoa=$r[0];
		$tam=mysql_query("select * from `hocki nienkhoa` where ma_hknk='$hknk' ");
		$t=mysql_fetch_row($tam);
		$hk=$t[1];$nk=$t[2];
		
		
?>
<table width="880" align="center" cellspacing="0" border="0"  cellpadding="0">
       		
      		<tr bordercolor="#FFFFFF"> 
           		<td align="center"  height="40" class="bg1" valign="middle">
                	<span class="style6" style="font-size:30px">
					KẾT QUẢ NHẬN XÉT MÔN HỌC 
					
					<input type="hidden" name="ma" value="<?php echo $makhoa; ?>" />
					<input type="hidden" name="hk" value="<?php echo $hknk; ?>;" />
					
								
					
					</span></td>
          	</tr>
			<tr><td height="30">&nbsp;</td></tr>
			<?php
			      $str=mysql_query("select * from `bo mon` where ma_khoa='$makhoa'");
				  while ($str1=mysql_fetch_row($str))
				  {
				      $mabm=$str1[0];
					  $tenbm=$str1[1];
			?>
			<tr bordercolor="#FFFFFF"> 
           		<td align="left" height="40" class="bg1" valign="middle" style="font-size:24px; font-weight:bold; color:#000099">
                	
							* Bộ Môn: <?php  echo $tenbm; ?>
			   </td>
          	</tr>
			<tr><td height="30">&nbsp;</td></tr>
			<tr>
			    <td>
				      <table width="890" align="center" cellspacing="0" border="1" bordercolor="#0066FF" cellpadding="0">
											
															
											<tr align="center"  bgcolor="#CCCCCC">
												<td  height="20"  rowspan="2" ><span class="style7">Mã HP</span>				
												</td>
												<td  height="20"  rowspan="2" ><span class="style7">Tên HP</span>				
												</td>
												<td   colspan="2"><span class="style7">Chưa Hài Lòng</span>			   
												</td>
												<td   colspan="2">
														  <span class="style7">Hài Lòng</span>				
												</td>
												<td   colspan="2">
														  <span class="style7">Rất Hài Lòng</span>				
												</td>
												<td   colspan="2">
														  <span class="style7">Xuất Sắc</span>				
												</td>
												
												
												
											</tr>
											<tr bgcolor="#CCCCCC">
											     
												 <td align="center" class="style7">
												       Số lượng
												 </td>
												 <td align="center" class="style7">
												       Tỉ lệ(%)
												 </td>
												 
												 <td align="center" class="style7">
												       Số lượng
												 </td>
												 <td align="center" class="style7">
												       Tỉ lệ(%)
												 </td>
												 
												 <td align="center" class="style7">
												       Số lượng
												 </td>
												 <td align="center" class="style7">
												       Tỉ lệ(%)
												 </td>
												 
												 <td align="center" class="style7">
												       Số lượng
												 </td>
												 <td align="center" class="style7">
												       Tỉ lệ(%)
												 </td>
												 
												 
											</tr>
								 <?php
		                $khl=array();
						$hl=array();
						$rhl=array();
						$xs=array();
		           
					
					   
													   $q=mysql_query("select  distinct(c.ma_hp),b.ten_hp from  `hoc phan` b, `lop hoc phan` c,`giang vien` d, `bo mon` e where  c.ma_hknk = '$hknk' and b.ma_hp=c.ma_hp and c.ma_gv=d.ma_gv and d.ma_bm=e.ma_bm and e.ma_khoa='$makhoa' and e.ma_bm='$mabm'  ");
													   while( $q1=mysql_fetch_row($q))
													   {
													            			
																$mahp=$q1[0];
									                            $tenhp=$q1[1];
																$demsv=0;
															     $truyvan=mysql_query("select * from `danh gia` a,`lop hoc phan` b where a.ma_hknk='$hknk' and a.ma_hp='$mahp' and ma_gv in (select ma_gv from `giang vien` where ma_bm='$mabm') and a.ma_hp=b.ma_hp and a.ma_hknk=b.ma_hknk and a.stt_nhom=b.stt_nhom  group by a.ma_sv,a.ma_hknk,a.stt_nhom,a.ma_hp");
																   while ($tv=mysql_fetch_row($truyvan))
																   {
																		  $demsv++;
																   }
																$sql1=mysql_query("select `muc danh gia`,count(*) from `danh gia` a,`lop hoc phan` b where  a.ma_hknk='$hknk' and `muc danh gia`='1' and a.ma_hp=b.ma_hp and a.ma_hknk=b.ma_hknk and a.stt_nhom=b.stt_nhom and a.ma_hp='$mahp' and ma_gv in (select ma_gv from `giang vien` where ma_bm='$mabm')  group by `muc danh gia`");
															    $sql2=mysql_query("select `muc danh gia`,count(*) from `danh gia` a,`lop hoc phan` b where a.ma_hknk='$hknk' and `muc danh gia`='2' and a.ma_hp=b.ma_hp and a.ma_hknk=b.ma_hknk and a.stt_nhom=b.stt_nhom and a.ma_hp='$mahp' and ma_gv in (select ma_gv from `giang vien` where ma_bm='$mabm') group by `muc danh gia`");
																$sql3=mysql_query("select `muc danh gia`,count(*) from `danh gia` a,`lop hoc phan` b where a.ma_hknk='$hknk'  and `muc danh gia`='3' and a.ma_hp=b.ma_hp and a.ma_hknk=b.ma_hknk and a.stt_nhom=b.stt_nhom and a.ma_hp='$mahp' and ma_gv in (select ma_gv from `giang vien` where ma_bm='$mabm')  group by `muc danh gia`");
															    $sql4=mysql_query("select `muc danh gia`,count(*) from `danh gia` a,`lop hoc phan` b where a.ma_hknk='$hknk' and `muc danh gia`='4' and a.ma_hp=b.ma_hp and a.ma_hknk=b.ma_hknk and a.stt_nhom=b.stt_nhom and a.ma_hp='$mahp' and ma_gv in (select ma_gv from `giang vien` where ma_bm='$mabm')  group by `muc danh gia`");
																   if(mysql_num_rows($sql1)==0) $muc1=0;
																   else
																   {
																   $r1=mysql_fetch_row($sql1);
																   $muc1=$r1[1];
																   }
																   if(mysql_num_rows($sql2)==0) $muc2=0;
																   else
																   {
																   $r2=mysql_fetch_row($sql2);
																   $muc2=$r2[1];
																   }
																   if(mysql_num_rows($sql3)==0) $muc3=0;
																   else
																   {
																   $r3=mysql_fetch_row($sql3);
																   $muc3=$r3[1];
																   }
																   if(mysql_num_rows($sql4)==0) $muc4=0;
																   else
																   {
																   $r4=mysql_fetch_row($sql4);
																   $muc4=$r4[1];
																   }
						   ?>
						   <tr >
						       <td  height="40" style="font-size:20px;" align="center">
							         <?php echo $mahp; ?> 
							   </td>
							   <td style="font-size:20px" align="center">
							        <?php
																				   
								          echo $tenhp;
									?>
							   </td>
							   
							   <td align="center" style="font-size:20px">
							          <?php echo $muc1; ?>
							   </td>
					
							   <td  align="center" style="font-size:20px">
							        <?php
									      $t=($muc1/($demsv*11))*100;
										  $t1=round($t,2);
										  $khl[]=$t1; 
										  echo " $t1 %  ";
										  
									?>
							   </td>
							   <td align="center" style="font-size:20px">
							          <?php echo $muc2; ?>
							   </td>
							   <td  align="center" style="font-size:20px">
							       <?php
									       
										  $t=($muc2/($demsv*11))*100;
										  $t1=round($t,2);
										  $hl[]=$t1; 
										  echo " $t1 %  ";
									?>
							   </td>
							   <td align="center" style="font-size:20px">
							          <?php echo $muc3; ?>
							   </td>
							   <td  align="center" style="font-size:20px">
							          <?php
									      
										  $t=($muc3/($demsv*11))*100;
										  $t1=round($t,2); 
										  $rhl[]=$t1;
										  echo " $t1 %  ";
									 ?>
							   </td>
							   <td align="center" style="font-size:20px">
							          <?php echo $muc4; ?>
							   </td>
							   <td  align="center" style="font-size:20px">
							          <?php
									       $t=($muc4/($demsv*11))*100;
										  $t1=round($t,2);
										  $xs[]=$t1; 
										  echo " $t1 %  ";
										   
									?>
							   </td> 
							  
								 
							     
                           </tr>
						   <?php
						      
						}//while
						 
					 
		   ?>
										  
										   </table>
				</td>
			</tr>
           
      		
          <tr><td height="30">&nbsp;</td></tr>
		  <?php }//ngoac while lon ?>
		   <tr bordercolor="#FFFFFF"> <td height="50">
				<table width="100%"> <tr >
					<td width="98%" ><label><div align="center">
					             <table cellpadding="0" cellspacing="0" border="0" width="200" height="40" bgcolor="#CCCCCC" style="border:1px solid #CCCCCC" >
								       <tr >
									         <td  class="style7">
											 <a class="mo" href="<?php echo "cnk-inbomontc.php?hk=$hknk";?>">In Kết Quả Đanh Giá</a>
											 
											 </td>
									   </tr>
								 </table>
					                 </div></label></td>
					<td width="2%" > </td>
				</tr> </table>
                </td> 
	      </tr>
		  <tr><td height="20" >&nbsp; </td></tr>
		  </table>
</body>
</html>

